package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/28 17:57
 *
 *@Desc: 缩小 + 淡出 效果（ZoomOut）
 */
class ZoomOutPageTransformer : ViewPager2.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        val scale = 0.85f.coerceAtLeast(1 - Math.abs(position))
        val alpha = 0.5f.coerceAtLeast(1 - Math.abs(position))
        view.scaleX = scale
        view.scaleY = scale
        view.alpha = alpha
        view.translationX = -position * view.width * 0.2f
    }
}
